home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 June: Reference Library / Dev.CD Jun 99 RL Disk 1.toast / What's New / Development Kits / Mac_OS_USB_DDK_v1.2 / Examples / PrinterClassDriver / ChooserPACK.r < prev    next >
Encoding:
Text File  |  1999-04-15  |  9.4 KB  |  345 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ChooserPACK.r
  3.  
  4.     Contains:    Rsrc description to build the PACK header and other rsrcs
  5.                 needed by the PACK code
  6.  
  7.  
  8.  
  9.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.     Change History:
  12.  
  13.         21 Mar 98     gp        Added
  14.  
  15.     To Do:
  16. */
  17.  
  18. /***********************************************************************************/
  19. /****  Includes                                                                    ****/
  20. /***********************************************************************************/
  21. #ifndef __CHOOSERPACK__
  22. #define __CHOOSERPACK__
  23.  
  24. #ifndef __COMMON__
  25. #include "Common.h"
  26. #endif
  27.  
  28. #ifndef __SYSTYPES_R__
  29. #include "Types.r"                /* To get system types */
  30. #endif
  31.  
  32. #ifndef __SYSTYPES_R__
  33. #include "SysTypes.r"
  34. #endif
  35.  
  36. /***********************************************************************************/
  37. /****  PACK                                                                        ****/
  38. /***********************************************************************************/
  39. /*
  40.  * When building a PACK resource, insert the line:
  41.  *
  42.  *        type 'PACK' as 'PACW';
  43.  *
  44.  * in your resource file before your "resource 'PACK' ..." declaration.
  45.  */
  46.  
  47. type 'PACW' {
  48.     unsigned integer    = $600e;        /* bra.s to offset $e        */
  49.     unsigned integer    = 0;            /* device ID (Usually 0)    */
  50.     literal longint        = 'PACK';        /* res type, always PACK    */
  51.     integer                = kPACKID;        /* res ID always -4096        */
  52.     integer;                            /* version of driver        */
  53.  
  54.     /*
  55.     Values for flags obtained from Chooser source code file RDEVEqu.a and
  56.     IM Devices, pp 1-46…
  57.     */
  58.     boolean notAppleTalkDev,        appleTalkDev;        /* 31:Appletalk device?        */
  59.     boolean notPAPDev,                papDev;                /* 30:Printer Access Protocol device? */
  60.     boolean notPostScriptDev,        postScriptDev;        /* 29:PostScript device?        */
  61.     boolean noMultiples,            multiples;            /* 28:multiple selections?        */
  62.     boolean noLeftButton,            leftButton;            /* 27:uses left button            */
  63.     boolean noRightButton,            rightButton;        /* 26:uses right button        */
  64.     boolean saveZone,                dontSaveZone;        /* 25:saved zone name            */
  65.     boolean doesntUseZones,            usesZones;            /* 24:uses zone names name        */
  66.     boolean intlChars,                noIntlChars;        /* 23:Translate int'l chars to U.S.? */
  67.     boolean noEvenName,                evenName;            /* 22:Is this a LaserWriter? */
  68.     boolean noLengthOnRename,        lengthOnRename;        /* 21:Pass length byte in Rename name? */
  69.     boolean noOnOff,                onOff;                /* 20:Device uses on/off radio buttons. */
  70.     boolean selfSend,                dontSelfSend;        /* 19:Receive info from this machine? */
  71.     boolean = 0;                                        /* 18:reserved                    */
  72.     boolean doesntAcceptInit,        acceptsInit;        /* 17:accepts Initialize msg    */
  73.     boolean doesntAcceptNewSel,        acceptsNewSel;        /* 16:accepts newSel msg        */
  74.     boolean doesntAcceptFillList,    acceptsFillList;    /* 15:accepts FillList msg        */
  75.     boolean doesntAcceptGetSel,        acceptsGetSel;        /* 14:accepts GetSel msg        */
  76.     boolean doesntAcceptSelect,        acceptsSelect;        /* 13:accepts Select msg        */
  77.     boolean doesntAcceptDeselect,    acceptsDeselect;    /* 12:accepts Deselect msg        */
  78.     boolean doesntAcceptTerm,        acceptsTerm;        /* 11:accepts Terminate msg        */
  79.     boolean doesntAcceptRename,        acceptsRename;        /* 10:accepts Rename msg        */
  80.     boolean = 0;                                        /*  9:reserved                    */
  81.     boolean = 0;                                        /*  8:reserved                    */
  82.     boolean = 0;                                        /*  7:reserved                    */
  83.     boolean = 0;                                        /*  6:reserved                    */
  84.     boolean = 0;                                        /*  5:reserved                    */
  85.     boolean = 0;                                        /*  4:reserved                    */
  86.     boolean = 0;                                        /*  3:reserved                    */
  87.     boolean = 0;                                        /*  2:reserved                    */
  88.     boolean = 0;                                        /*  1:reserved                    */
  89.     boolean packExists,                noPackage;            /*  0:Is the Package really there? */
  90.  
  91.     /*
  92.     The PACK code is inserted here by Rez. Use the $$Resource() directive…
  93.     */
  94.     hex string;
  95. };
  96.  
  97. type 'CTYP' {
  98.     unsigned integer    = 0;        /* type of connection for selected printer 0-none 1-serial 2-UBB */
  99.     unsigned integer doesntSupportSerial,        supportsSerial;
  100.     unsigned integer doesntSupportUSB,            supportsUSB;
  101. };
  102.  
  103. /*
  104. *    What connection types we support and the type of connection for the selected printer
  105. */
  106. resource 'CTYP'(1000, purgeable ) {
  107.     supportsSerial,
  108.     supportsUSB
  109. };
  110.  
  111. /*
  112. *    Path in name registry for the printer models this driver supports
  113. */
  114. resource 'STR#'(1000, purgeable ) {
  115.     {
  116.     "Devices:device-tree:PRINTER:Color StyleWriter 6500",
  117.     "Devices:device-tree:PRINTER:DeskJet 870C",
  118.     }
  119. };
  120.  
  121. /*
  122. *    Path in name registry for the last selected usb printer
  123. *    The code should not change the size of the rsrcs. 
  124. *    Therefore this rsrc must be kepted at a fixed length 
  125. *    size of 256 bytes!
  126. */
  127.  
  128. data 'STR ' (2000, purgeable) {
  129.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  130.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  131.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  132.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  133.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  134.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  135.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  136.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  137.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  138.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  139.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  140.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  141.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  142.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  143.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  144.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  145. };
  146.  
  147. /*
  148. *    Name of last selected usb printer
  149. *    The code should not change the size of the rsrcs. 
  150. *    Therefore this rsrc must be kepted at a fixed length 
  151. *    size of 256 bytes!
  152. */
  153.  
  154. data 'STR ' (2100, purgeable) {
  155.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  156.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  157.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  158.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  159.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  160.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  161.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  162.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  163.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  164.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  165.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  166.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  167.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  168.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  169.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  170.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  171. };
  172.  
  173. /*
  174. *    Color table for no Name Registry alert dialog
  175. */
  176. resource 'actb' (3000) {
  177.     {    /* array ColorSpec: 5 elements */
  178.         /* [1] */
  179.         wContentColor, 65535, 65535, 65535,
  180.         /* [2] */
  181.         wFrameColor, 0, 0, 0,
  182.         /* [3] */
  183.         wTextColor, 0, 0, 0,
  184.         /* [4] */
  185.         wHiliteColor, 0, 0, 0,
  186.         /* [5] */
  187.         wTitleBarColor, 65535, 65535, 65535
  188.     }
  189. };
  190.  
  191. /*
  192. *    Alert used when Name Registry isnt present
  193. */
  194. resource 'ALRT' (3000) {
  195.     {50, 30, 180, 430},
  196.     3000,
  197.     {    /* array: 4 elements */
  198.         /* [1] */
  199.         OK, visible, sound1,
  200.         /* [2] */
  201.         OK, visible, sound1,
  202.         /* [3] */
  203.         OK, visible, sound1,
  204.         /* [4] */
  205.         OK, visible, sound1
  206.     }
  207.     ,alertPositionMainScreen
  208. };
  209.  
  210. /*
  211. *    DITL for alert
  212. */
  213. resource 'DITL' (3000) {
  214.     {    /* array DITLarray: 2 elements */
  215.         /* [1] */
  216.         {97, 313, 117, 387},
  217.         Button {
  218.             enabled,
  219.             "OK"
  220.         },
  221.         /* [2] */
  222.         {13, 74, 84, 387},
  223.         StaticText {
  224.             disabled,
  225.             "The Name Registry is missing from this c"
  226.             "omputer. It is required by this driver t"
  227.             "o function properly."
  228.         }
  229.     }
  230. };
  231.  
  232. /*
  233. *    Color table for printer not available alert dialog
  234. */
  235. resource 'actb' (3100) {
  236.     {    /* array ColorSpec: 5 elements */
  237.         /* [1] */
  238.         wContentColor, 65535, 65535, 65535,
  239.         /* [2] */
  240.         wFrameColor, 0, 0, 0,
  241.         /* [3] */
  242.         wTextColor, 0, 0, 0,
  243.         /* [4] */
  244.         wHiliteColor, 0, 0, 0,
  245.         /* [5] */
  246.         wTitleBarColor, 65535, 65535, 65535
  247.     }
  248. };
  249.  
  250. /*
  251. *    Alert used when Name Registry isnt present
  252. */
  253. resource 'ALRT' (3100) {
  254.     {50, 30, 180, 430},
  255.     3100,
  256.     {    /* array: 4 elements */
  257.         /* [1] */
  258.         OK, visible, sound1,
  259.         /* [2] */
  260.         OK, visible, sound1,
  261.         /* [3] */
  262.         OK, visible, sound1,
  263.         /* [4] */
  264.         OK, visible, sound1
  265.     }
  266.     ,alertPositionMainScreen
  267. };
  268.  
  269. /*
  270. *    DITL for alert
  271. */
  272. resource 'DITL' (3100) {
  273.     {    /* array DITLarray: 2 elements */
  274.         /* [1] */
  275.         {97, 313, 117, 387},
  276.         Button {
  277.             enabled,
  278.             "OK"
  279.         },
  280.         /* [2] */
  281.         {13, 74, 84, 387},
  282.         StaticText {
  283.             disabled,
  284.             "The previously selected printer cannot b"
  285.             "e found. Please make sure the printer is"
  286.             " on, check the connections or make anoth"
  287.             "er selection."
  288.         }
  289.     }
  290. };
  291.  
  292.  
  293. /*
  294.  * This will produce a PACK resource from the special PACW type.
  295.  * (this eliminates the need for using the Assembler to create
  296.  *    the DA header, but makes it impossible to use SADE, oops!)
  297.  *
  298.  */
  299.  
  300. type 'PACK' as 'PACW';            /* Map 'PACW' => 'PACK' */
  301.  
  302. resource 'PACK' (kPACKID, purgeable) {
  303.     /*
  304.      * device version
  305.      */
  306.     3,
  307.     
  308.     /*
  309.      * PACK flags
  310.      */
  311.     notAppleTalkDev,        /* non appletalk device            */
  312.     notPAPDev,                /* non PAP device                */
  313.     notPostScriptDev,        /* non PostScript device        */
  314.     noMultiples,            /* multiple instances            */
  315.     noLeftButton,            /* use left button                */
  316.     noRightButton,            /* use right button                */
  317.     dontSaveZone,            /* save zone name                */
  318.     doesntUseZones,            /* uses zone names name            */
  319.     intlChars,                /* let international chars through */
  320.     noEvenName,                /* not a LaserWriter; leave the name alone */
  321.     noLengthOnRename,        /* don't send the length byte with the name */
  322.     noOnOff,                /* doesn't use on/off button    */
  323.     selfSend,                /* not really relevant            */
  324.     acceptsInit,            /* Accepts the Initialize msg    */
  325.     doesntAcceptNewSel,        /* no newSel msg                */
  326.     acceptsFillList,        /* FillList msg                    */
  327.     acceptsGetSel,            /* accepts GetSel msg            */
  328.     acceptsSelect,            /* accepts Select msg            */
  329.     acceptsDeselect,        /* Deselect msg                    */
  330.     acceptsTerm,            /* accept Terminate msg            */
  331.     doesntAcceptRename,        /* doesn't accept rename msg    */
  332.     packExists,                /* package really exists        */
  333.  
  334.     /*
  335.      * This directive inserts the contents of the PACW resource
  336.      * with our PACK code
  337.      */
  338.     #ifdef __MPW__
  339.         $$Resource("::ChsrPACW.rsrc", 'PACW', 0)
  340.     #else
  341.         $$Resource("ChsrPACW.rsrc", 'PACW', 0)
  342.     #endif
  343. };
  344.  
  345. #endif